package com.example.demo.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.example.demo.GenericDaoImpl;
import com.example.demo.dao.RoleDao;
import com.example.demo.dao.Selectable;
import com.example.demo.model.SysRoleModel;

@Repository("roleDao")
public class RoleDaoImpl extends GenericDaoImpl<SysRoleModel,String> implements RoleDao   {

	
	private static final Logger logger = LoggerFactory.getLogger(RoleDaoImpl.class);
	
	
	@Autowired
	protected Selectable selectable;

	/*@Override
	public List<Map<String, Object>> queryRoleList() {
		return baseDao.selectList("select * from sys_role", null);
	}*/
	
	@Override
	public List<SysRoleModel> queryRoleList(){
		logger.info("查询sql语句："+"select * from sys_role where 1=1");
		return selectable.select(SysRoleModel.class,"select * from sys_role where 1=1", null);
	}
	
	@Override
	public List<SysRoleModel> queryRoleByHql(){
		logger.info("查询sql语句："+"select * from sys_role where 1=1");
 		return this.queryByHql(" from sysRole ");
	}

	@Override
	public List<SysRoleModel> queryRoleListByHql(){
		logger.info("开始查询用户角色列表....");
		Map<String, String> params = new  HashMap<String, String>();
		String hql = "from sysRole where roleName = :roleName ";
		params.put("roleName", "test");
		return queryByHql(hql, params);
	}
	
	
	 
	

	 

 
	
	
}
